package com.qing.expert.modules.admin.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qing.expert.common.response.R;
import com.qing.expert.modules.admin.service.AdminLogService;
import com.qing.expert.modules.admin.vo.response.OperationLogVO;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/api/admin/logs")
public class AdminLogController {

    @Resource
    private AdminLogService adminLogService;

    /**
     * 查看操作日志
     */
    @GetMapping
    public R<Page<OperationLogVO>> getOperationLogs(
            @RequestParam(required = false) String action,
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer size) {
        return R.ok(adminLogService.getOperationLogs(action, page, size));
    }
}